<?php

namespace App\Http\Requests\Admin;
use Illuminate\Validation\Rule;

class MachineRequest extends FormRequest
{
    

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'imei' => ['required', Rule::unique('machines')->ignore(request()->id)]
        ];
    }

    public function messages()
    {
        return [
            'imei.required' => 'imei号不能为空',
            'imei.unique' => '该设备已经存在',
        ];
    }
}
